<template>
  <div class="app-container">
    <section class="title">
      <h1>{{ overviewData.name }}</h1>
      <span v-if="overviewData.head"> —— {{ overviewData.head.nickname }}</span>
    </section>
    <!-- <el-progress :text-inside="true" :stroke-width="26" :percentage="70" /> -->
    <!-- <p class="desc">（已完成的工作项时长+未完成的工作项时长*进度百分比）/项目中所有工作项的总时长，需求和缺陷不统计在内。</p> -->

    <section class="box-list">
      <div class="circle-box">
        <p>任务</p>
        <div class="circle">
          {{ overviewData.task && overviewData.task.done }}/{{ overviewData.task && overviewData.task.total }}
        </div>
      </div>
      <div class="circle-box">
        <p>需求</p>
        <div class="circle">
          {{ overviewData.demand && overviewData.demand.done }}/{{ overviewData.demand && overviewData.demand.total }}
        </div>
      </div>
      <div class="circle-box">
        <p>缺陷</p>
        <div class="circle">
          {{ overviewData.defect && overviewData.defect.done }}/{{ overviewData.defect && overviewData.defect.total }}
        </div>
      </div>
      <div class="circle-box">
        <p>逾期</p>
        <div class="circle">
          {{ overviewData.overdue }}
        </div>
      </div>
    </section>
  </div>
</template>

<script>
import * as ProjectApi from '@/api/project'

export default {
  name: 'Overview',
  data() {
    return {
      overviewData: {}
    }
  },
  mounted() {
    this.getProjectDetail()
  },
  methods: {
    async getProjectDetail() {
      const id = this.$route.params.id
      if (!id) return
      const { data } = await ProjectApi.getProject(id)
      if (data) {
        this.overviewData = data
        this.$emit('propReviewUser', data.head)
        this.$emit('setTitle', data.name)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  display: flex;
  align-items: center;
  span {
    color: #303133;
    margin-left: 1rem;
    font-size: 16px;
  }
}
.desc {
  color: #606266;
}
.box-list {
  display: flex;
}
.circle-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  .circle {
    width: 5rem;
    height: 5rem;
    border: 1px solid #303133;
    border-radius: 50%;
    text-align: center;
    line-height: 5rem;
  }
}
</style>
